; REQUIRES: diasdk

; RUN: llvm-pdbutil pretty -injected-sources -injected-source-content \
; RUN:   %p/Inputs/InjectedSource.pdb | FileCheck %s
; RUN: llvm-pdbutil pretty -injected-sources -injected-source-content \
; RUN:   %p/Inputs/ClassLayoutTest.pdb | FileCheck --check-prefix=NEGATIVE %s

; CHECK:      ---INJECTED SOURCES---
; CHECK:      c.natvis (140 bytes): obj=<null>, vname=c.natvis, crc=334478030, compression=None
; CHECK-NEXT: <?xml version="1.0" encoding="utf-8"?>
; CHECK-NEXT: <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
; CHECK-NEXT: </AutoVisualizer>
; CHECK:      a.natvis (140 bytes): obj=<null>, vname=a.natvis, crc=334478030, compression=None
; CHECK-NEXT: <?xml version="1.0" encoding="utf-8"?>
; CHECK-NEXT: <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
; CHECK-NEXT: </AutoVisualizer>
; CHECK:      b.natvis (294 bytes): obj=<null>, vname=b.natvis, crc=2059731902, compression=None
; CHECK-NEXT: <?xml version="1.0" encoding="utf-8"?>
; CHECK-NEXT: <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
; CHECK-NEXT: <Type Name="Baz">
; CHECK-NEXT:   <DisplayString>Third test</DisplayString>
; CHECK-NEXT: </Type>
; CHECK-NEXT: <Type Name="Buzz">
; CHECK-NEXT:   <DisplayString>Fourth test</DisplayString>
; CHECK-NEXT: </Type>
; CHECK-NEXT: </AutoVisualizer>

; NEGATIVE:      ---INJECTED SOURCES---
; NEGATIVE-NEXT: There are no injected sources.

; PDB created by running `csc /debug Hello.cs`
; RUN: llvm-pdbutil pretty -native -injected-sources -injected-source-content \
; RUN:   %p/Inputs/dotnet_hashonly.pdb | FileCheck --check-prefix=HASH %s

; HASH:      ---INJECTED SOURCES---
; HASH:      C:\src\llvm-mono\Hello.cs (92 bytes): obj=<null>, vname=c:\src\llvm-mono\hello.cs, crc=269413292, compression=DotNet
; HASH-NEXT: Compressed data (
; HASH-NEXT:   0000: F862513F C607D311 905300C0 4FA302A1 C4454B99 E9E6D211 903F00C0 4FA302A1  |.bQ?.....S..O....EK......?..O...|
; HASH-NEXT:   0020: 0B9D865A 1166D311 BD2A0000 F80849BD EC1618FF 5EAA104D 87F76F49 63833460  |...Z.f...*....I.....^..M..oIc.4`|
; HASH-NEXT:   0040: 14000000 00000000 17299CBE 74FDDF66 FFCD5E08 CE34A775 D464C611           |.........)..t..f..^..4.u.d..|
; HASH-NEXT: )

; PDB created by running `csc /debug Hello.cs` with Hello.cs smaller than 200 bytes.
; RUN: llvm-pdbutil pretty -native -injected-sources -injected-source-content \
; RUN:   %p/Inputs/dotnet_contents_uncompressed.pdb | FileCheck --check-prefix=UNCOMP %s

; UNCOMP:      ---INJECTED SOURCES---
; UNCOMP:      C:\src\llvm-mono\Hello.cs (232 bytes): obj=<null>, vname=c:\src\llvm-mono\hello.cs, crc=323787205, compression=DotNet
; UNCOMP-NEXT: Compressed data (
; UNCOMP-NEXT:   0000: F862513F C607D311 905300C0 4FA302A1 C4454B99 E9E6D211 903F00C0 4FA302A1  |.bQ?.....S..O....EK......?..O...|
; UNCOMP-NEXT:   0020: 0B9D865A 1166D311 BD2A0000 F80849BD EC1618FF 5EAA104D 87F76F49 63833460  |...Z.f...*....I.....^..M..oIc.4`|
; UNCOMP-NEXT:   0040: 14000000 8C000000 17299CBE 74FDDF66 FFCD5E08 CE34A775 D464C611 00000000  |.........)..t..f..^..4.u.d......|
; UNCOMP-NEXT:   0060: 6E616D65 73706163 65204865 6C6C6F57 6F726C64 207B0D0A 636C6173 73204865  |namespace HelloWorld {..class He|
; UNCOMP-NEXT:   0080: 6C6C6F20 7B0D0A20 20737461 74696320 766F6964 204D6169 6E282920 7B205379  |llo {..  static void Main() { Sy|
; UNCOMP-NEXT:   00A0: 7374656D 2E436F6E 736F6C65 2E577269 74654C69 6E652822 48656C6C 6F206173  |stem.Console.WriteLine("Hello as|
; UNCOMP-NEXT:   00C0: 64666A6B 6C777763 6F697762 72796669 75667566 20576F72 6C642122 293B207D  |dfjklwwcoiwbryfiufuf World!"); }|
; UNCOMP-NEXT:   00E0: 0D0A7D0D 0A7D0D0A                                                        |..}..}..|
; UNCOMP-NEXT: )

; PDB created by running `csc /debug Hello.cs` with Hello.cs larger than 200 bytes.
; RUN: llvm-pdbutil pretty -native -injected-sources -injected-source-content \
; RUN:   %p/Inputs/dotnet_contents_compressed.pdb | FileCheck --check-prefix=COMP %s

; COMP:      ---INJECTED SOURCES---
; COMP:      C:\src\llvm-mono\Hello.cs (218 bytes): obj=<null>, vname=c:\src\llvm-mono\hello.cs, crc=616104201, compression=DotNet
; COMP-NEXT: Compressed data (
; COMP-NEXT:   0000: F862513F C607D311 905300C0 4FA302A1 C4454B99 E9E6D211 903F00C0 4FA302A1  |.bQ?.....S..O....EK......?..O...|
; COMP-NEXT:   0020: 0B9D865A 1166D311 BD2A0000 F80849BD EC1618FF 5EAA104D 87F76F49 63833460  |...Z.f...*....I.....^..M..oIc.4`|
; COMP-NEXT:   0040: 14000000 7E000000 52CD36A0 6A9824CD A3034543 7FA9765E D572DA21 FB000000  |....~...R.6.j.$...EC..v^.r.!....|
; COMP-NEXT:   0060: CB4BCC4D 2D2E484C 4E55F048 CDC9C90F CF2FCA49 51A8E6E5 4ACE492C 2E868881  |.K.M-.HLNU.H...../.IQ...J.I,....|
; COMP-NEXT:   0080: B80A0AC5 25892599 C90A65F9 99290ABE 8999791A 9A0AD50A C195C525 A9B97ACE  |....%.%...e..)....y........%..z.|
; COMP-NEXT:   00A0: F979C5F9 39A97AE1 459925A9 3E9979A9 1A4A109D 89C52969 59D939E5 E5C9F999  |.y..9.z.E.%.>.y..J....)iY.9.....|
; COMP-NEXT:   00C0: E5494595 6999A569 A5690321 0CF698A2 92A6B542 2D2F1704 0100               |.IE.i..i.i.!.......B-/....|
; COMP-NEXT: )
